/* 全局样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 20px;
    text-align: center;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
}

/* 主内容样式 */
main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

section {
    background: white;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

section h3 {
    color: #34495e;
    margin: 20px 0 15px 0;
}

section h4 {
    color: #7f8c8d;
    margin: 15px 0 10px 0;
}

/* 表单样式 */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* 日志源配置样式 */
.log-source {
    background: #f8f9fa;
    border-left: 4px solid #667eea;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.log-source:hover {
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

/* 关联信息样式 */
.correlation-info {
    background: #e8f4fd;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    border-left: 4px solid #3498db;
}

.correlation-info strong {
    color: #2980b9;
}

/* 关联预览样式 */
.correlation-preview {
    margin-top: 30px;
    padding: 20px;
    background: #f0f4f8;
    border-radius: 8px;
    border: 1px solid #e1e5e9;
}

.correlation-preview h4 {
    margin-top: 0;
    color: #2c3e50;
}

.visualization {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
}

.visualization-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 600px;
    margin-bottom: 20px;
}

.source-box {
    padding: 15px 25px;
    border-radius: 6px;
    font-weight: bold;
    text-align: center;
    min-width: 120px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.source-box.source1 {
    background: #ff6b6b;
    color: white;
}

.source-box.source2 {
    background: #48dbfb;
    color: white;
}

.correlation-box {
    padding: 15px 30px;
    background: #1dd1a1;
    color: white;
    border-radius: 6px;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.connector {
    height: 4px;
    background: #95a5a6;
    flex-grow: 1;
    max-width: 100px;
    position: relative;
}

.connector::after {
    content: '⟷';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #f0f4f8;
    padding: 0 10px;
    font-size: 18px;
    color: #7f8c8d;
}

#correlation-details {
    text-align: center;
    color: #555;
    font-style: italic;
    margin-top: 10px;
    padding: 10px;
    background: white;
    border-radius: 4px;
    border-left: 3px solid #3498db;
    width: 100%;
    max-width: 600px;
}

/* 按钮样式 */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#save-rule {
    background-color: #27ae60;
    color: white;
}

#save-rule:hover {
    background-color: #229954;
}

#apply-rule {
    background-color: #3498db;
    color: white;
}

#apply-rule:hover {
    background-color: #2980b9;
}

#clear-rule {
    background-color: #e74c3c;
    color: white;
}

#clear-rule:hover {
    background-color: #c0392b;
}

#generate-logs {
    background-color: #9b59b6;
    color: white;
}

#generate-logs:hover {
    background-color: #8e44ad;
}

#view-events {
    background-color: #f39c12;
    color: white;
}

#view-events:hover {
    background-color: #e67e22;
}

/* 规则列表样式 */
#rules-container {
    max-height: 300px;
    overflow-y: auto;
}

.rule-item {
    background: #f8f9fa;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    border-left: 4px solid #3498db;
}

.rule-item h4 {
    margin-top: 0;
    color: #3498db;
}

.rule-item .rule-details {
    font-size: 0.9em;
    color: #666;
    margin: 10px 0;
}

.rule-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.rule-actions button {
    padding: 5px 15px;
    font-size: 0.9em;
}

.rule-actions .delete-rule {
    background-color: #e74c3c;
    color: white;
}

.rule-actions .edit-rule {
    background-color: #f39c12;
    color: white;
}

/* 模拟结果样式 */
#simulation-results {
    margin-top: 20px;
    max-height: 400px;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    white-space: pre-wrap;
}

.event-item {
    background: #fff;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    border-left: 4px solid #e74c3c;
}

.event-item h4 {
    margin-top: 0;
    color: #e74c3c;
}

/* 响应式设计 */
@media (min-width: 768px) {
    main {
        grid-template-columns: 1fr 1fr;
    }
    
    #simulation-section {
        grid-column: 1 / -1;
    }
}

@media (min-width: 992px) {
    .button-group {
        justify-content: flex-start;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

section {
    animation: fadeIn 0.5s ease-out;
}

/* 聚合配置样式 */
#aggregation-config {
    margin-top: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    transition: all 0.3s ease;
}

#aggregation-config:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 聚合预览样式 */
.aggregation-preview {
    background-color: #e3f2fd;
    padding: 10px 15px;
    border-radius: 6px;
    border-left: 4px solid #2196f3;
    margin-bottom: 20px;
}

.aggregation-preview p {
    margin: 0;
    font-size: 14px;
}

/* 滑块容器样式 */
.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 8px;
}

/* 滑块样式 */
.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    outline: none;
    transition: background 0.3s;
}

.slider:hover {
    background: #bbb;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #2196f3;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #1976d2;
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #2196f3;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    background: #1976d2;
}

/* 滑块输入组样式 */
.slider-input-group {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 120px;
}

/* 滑块值输入框样式 */
.slider-value {
    width: 60px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
}

/* 阈值配置样式 */
.threshold-config {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 10px;
}

.threshold-type,
.threshold-value {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.threshold-type label,
.threshold-value label {
    font-weight: 500;
    font-size: 14px;
    color: #555;
    margin-bottom: 5px;
}

/* 阈值类型选择框样式 */
#aggregation-threshold-type,
#aggregation-count-method {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.3s;
}

#aggregation-threshold-type:hover,
#aggregation-count-method:hover {
    border-color: #2196f3;
}

#aggregation-threshold-type:focus,
#aggregation-count-method:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

/* 单位选择框样式 */
#aggregation-window-unit {
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
    cursor: pointer;
}

/* 描述文本样式 */
.description {
    margin-top: 8px;
    padding: 8px 12px;
    background-color: #f0f0f0;
    border-radius: 4px;
    font-size: 13px;
    color: #555;
    border-left: 3px solid #666;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}